<include file="Public:header_content" />

    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>清除站内缓存</h5>
                    </div>

                    <div class="ibox-content">

                        <div class="row text-center">

                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-danger btn-sm demo3" id="caches">清除数据缓存</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-danger btn-sm demo3" id="cachehtml">清除静态HTML</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-primary btn-sm demo3" id="runtimecache">清除运行cache</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-primary btn-sm demo3" id="runtimelog">清除运行logs</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-primary btn-sm demo3" id="runtimedata">清除运行Data</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-warning btn-sm demo3" id="collectlog">清除采集logs</button>
                            </div>
                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-danger btn-sm demo3" id="mysqlOPTIMIZE">mysql数据库优化</button>
                            </div>
                             <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-danger btn-sm demo3" id="mysqlREPAIR">mysql数据库修复</button>
                            </div>

                            <div class="col-sm-6 h-100 p-lg">
                                <button class="btn btn-primary btn-sm sitemap" >生成sitemap</button>
                            </div>
                        </div>
                        <div class="m-t-md">
                            <p>

                            </p>


                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
<include file="Public:footer_content" />
<script>
$(function(){
    $('.sitemap').click(function(){
        $.ajax({
            type: "POST",
            url: "<{:U('Index/createMap')}>",
            data: "do=sitemap",
            success: function(msg){
              if(msg == 'success'){
                    swal("地图生成成功","","success");
              }else{
                 swal("地图生成失败","","error");
              }
            }
         });

    });

    $('.demo3').bind('click',function(){
        dos = $(this).attr('id');
        if(dos == 'runtimelog' || dos == 'runtimecache'){
            clearDo(dos);
            return;
        }
        swal({
            title: "您确定要继续这个操作",
            text: "清除后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "清除",
            closeOnConfirm: false,
            cancelButtonText:'取消'
        }, function () {
            clearDo(dos);
        });



    });

});

function clearDo(dos=''){
    $.ajax({
        type: "POST",
        url: "<{:U('Index/clearCa')}>",
        data: "do="+dos,
        success: function(msg){
          if(msg == 'success'){
                swal("清除成功","","success");
          }else{
             swal("清除失败","","error");
          }
        }
     });

}
</script>